home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / printing / nenscrip.000 / nenscrip / nenscript-1.13++ / machdep.h < prev    next >
C/C++ Source or Header  |  1992-11-24  |  1KB  |  69 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. /*****************************************************
  6.  *
  7.  *  MSDOS stuff 
  8.  *
  9.  *****************************************************/
  10.  
  11. #ifdef MSDOS
  12.  
  13. # include <ctype.h>
  14. # include <string.h>
  15. # include <malloc.h>
  16.  
  17. # define STRICMP(s1,s2) _stricmp (s1,s2)
  18. # ifdef _WINDOWS
  19. #  define    STRDUP(str)    _strdup(str)
  20. # else
  21. #  define    STRDUP(str)    strdup(str)
  22. # endif
  23.  
  24. # define USERNAME    getenv("LOGNAME")!=NULL?getenv("LOGNAME"):getenv("USER")!=NULL?getenv("USER"):"Unknown")
  25.  
  26. # define    GETTIME(tm,str)    strftime(str,15,"%X",tm)
  27.  
  28. # ifdef US_VERSION
  29. #  define     GETDATE(tm,str) strftime(str,15,"%b %d %y",tm)
  30. # else
  31. #  define    GETDATE(tm,str) strftime(str,15,"%d %b %y",tm)
  32. # endif
  33.  
  34. #else
  35.  
  36. /*****************************************************
  37.  *
  38.  *  Unix stuff
  39.  *
  40.  *****************************************************/
  41.  
  42. # include <pwd.h>
  43. # include <string.h>
  44. # ifdef __STDC__
  45. #  include <unistd.h>
  46. # endif
  47.  
  48. # define    LPR        "lpr -P "        /* spooler with option to set name of printer */
  49.  
  50. # define    STRICMP(s1,s2)    strcasecmp(s1,s2)
  51. # ifdef ultrix
  52. #  define    STRDUP(str)    strcpy(malloc(strlen(str)+1), str)
  53. # else
  54. #  define    STRDUP(str)    strdup(str)
  55. # endif
  56.  
  57. # define    USERNAME    ((getpwuid (getuid()))->pw_name)
  58.  
  59. # define     GETTIME(tm,str)    strftime(str,15,"%T",tm)
  60.  
  61. # ifdef US_VERSION
  62. #  define    GETDATE(tm,str) strftime(str,15,"%h %d %y",tm)
  63. # else
  64. #  define    GETDATE(tm,str) strftime(str,15,"%d %h %y",tm)
  65. # endif
  66.  
  67. #endif
  68.  
  69.